home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / mntdoc01.zoo / mintdoc / cat2 / dlock.nr < prev    next >
Encoding:
Text File  |  1993-03-03  |  3.8 KB  |  133 lines

  1.  
  2.  
  3.  
  4. Dlock(2)                   Jan. 8, 1993                  Dlock(2)
  5.  
  6.  
  7. N✓NA✓AM✓ME✓E
  8.        Dlock - lock or unlock a BIOS disk device
  9.  
  10. S✓SY✓YN✓NO✓OP✓PS✓SI✓IS✓S
  11.        LONG Dlock( WORD mode, WORD drv );
  12.  
  13. D✓DE✓ES✓SC✓CR✓RI✓IP✓PT✓TI✓IO✓ON✓N
  14.        _✓D_✓l_✓o_✓c_✓k  is used to lock or unlock the BIOS device indicated
  15.        by _✓d_✓r_✓v.  No GEMDOS file  operations  are  permitted  on  a
  16.        locked  drive.  Thus,  the _✓D_✓l_✓o_✓c_✓k call provides a mechanism
  17.        for disk formatters or re-organizers  to  lock  out  other
  18.        processes  while low-level BIOS or XBIOS operations are in
  19.        progress on the device.
  20.  
  21.        If bit 0 of _✓m_✓o_✓d_✓e is 1, the drive is locked;  if  it  is  _✓0
  22.        then  the drive is unlocked and may be used again by other
  23.        programs.  If a process terminates while holding a lock on
  24.        a drive, that drive is automatically unlocked.
  25.  
  26.        Bit 1 of _✓m_✓o_✓d_✓e indicates what return values are desired. If
  27.        this bit is 1, and if the drive is locked by a  user  pro-
  28.        cess  different  from  the  caller, or if some process has
  29.        files open on the drive, then that  process'  id  will  be
  30.        returned  (see  below).  This may be used to report a more
  31.        useful error message to the user (by telling  him  or  her
  32.        which  process  is using the drive in question when a lock
  33.        operation fails).
  34.  
  35.        All other bits of _✓m_✓o_✓d_✓e are reserved and must be set to  0.
  36.  
  37.        A lock operation followed immediately by an unlock is very
  38.        similar to a media change, except that the lock  operation
  39.        will  fail if there are open files that refer to the indi-
  40.        cated drive.
  41.  
  42.  
  43. R✓RE✓ET✓TU✓UR✓RN✓NS✓S
  44.        0 if the lock/unlock operation was successful
  45.  
  46.        EDRIVE if _✓d_✓r_✓v is not a valid BIOS device number
  47.  
  48.        For a lock operation, the following  error  codes  may  be
  49.        returned:
  50.  
  51.        A  positive  process  id  if bit 1 of _✓m_✓o_✓d_✓e is set, and the
  52.        drive is already locked or in use by another user process.
  53.  
  54.        EACCDN  if  bit  1  of _✓m_✓o_✓d_✓e is clear and either open files
  55.        exist on the drive  or  another  process  is  searching  a
  56.        directory on the drive, or if bit 1 of _✓m_✓o_✓d_✓e is set and the
  57.        drive is in use by the operating system.
  58.  
  59.        ELOCKED if bit 1 of _✓m_✓o_✓d_✓e is clear and another process  has
  60.        locked  the  drive,  or  if  bit  1 of _✓m_✓o_✓d_✓e is set and the
  61.  
  62.  
  63.  
  64. Version 0.99         MiNT Programmer's Manual                   1
  65.  
  66.  
  67.  
  68.  
  69.  
  70. Dlock(2)                   Jan. 8, 1993                  Dlock(2)
  71.  
  72.  
  73.        operating system has locked the drive.
  74.  
  75.        For an unlock operation the following error codes  may  be
  76.        returned:
  77.  
  78.        ENSLOCK  if _✓m_✓o_✓d_✓e is 0 and the drive was not locked by this
  79.        process
  80.  
  81. S✓SE✓EE✓E A✓AL✓LS✓SO✓O
  82.        _✓F_✓x_✓a_✓t_✓t_✓r(2)
  83.  
  84.  
  85. N✓NO✓OT✓TE✓ES✓S
  86.        Note that _✓D_✓l_✓o_✓c_✓k operates on BIOS devices,  which  may  not
  87.        always be in 1-1 correspondence with GEMDOS drive letters.
  88.        For this reason, to lock GEMDOS drive  A:  (for  example),
  89.        the programmer should call _✓F_✓x_✓a_✓t_✓t_✓r on the root directory of
  90.        A: ("A:\") and then use the _✓d_✓e_✓v  field  of  the  structure
  91.        returned in order to determine the BIOS device correspond-
  92.        ing to the GEMDOS drive.
  93.  
  94.  
  95. B✓BU✓UG✓GS✓S
  96.        All GEMDOS operations are forbidden  on  a  locked  drive,
  97.        even  by  the  process  that created the lock. It would be
  98.        useful to have a mode which allowed  the  locking  process
  99.        (and  only the locking process) to still make GEMDOS calls
  100.        on the drive, but unfortunately the structure  of  the  OS
  101.        makes  this  difficult;  there is also the above-mentioned
  102.        difference between BIOS and GEMDOS devices to consider.
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130. Version 0.99         MiNT Programmer's Manual                   2
  131.  
  132.  
  133.